define(function(require,exports,module){
	var Subnav = require("subnav");
	var aw = require("ajaxwrapper");
	var MemTransferForm = require("../component/MemTransferForm");
	module.exports = {
		initComponent: function(params,widget){
			var subnav = new Subnav({
				parentNode: ".J-subnav",
				model: {
					title: "会员证转让",
					items: [{
						id:"search",
						type: "search",
						placeholder: "会员证号/合同号",
						handler: function(str){
							aw.ajax({
								url: "api/certificatestransfer/search",
								data: {
									s: str,
									properties: "travelContract.memberCertificates,travelContract.contactNo",
									fetchProperties: widget.constant.mainProperties 
								},
								success: function(data){
									widget.get("grid").setData(data);
								}
							});
						}
					},{
			            id: "dateRange",
			            type: "daterange",
			            ranges: {
			                "本年": [moment().startOf("years"), moment().endOf("years")],
			                "本月": [moment().startOf("month"), moment().endOf("month")]
			            },
			            defaultRange: "本年",
			            minDate: "1930-05-31",
			            maxDate: "2020-12-31",
			            handler: function(time) {
			            	widget.get("grid").refresh();
			            },
			            tip: "办理日期"
			        },{
						id: "add",
						type: "button",
						text: "新增",
						handler: function(){
							MemTransferForm.renderForm(widget,true);
							$(".J-form-endForm-save").removeClass("hidden");
			    			$(".J-form-endForm-cancel").removeClass("hidden");
							widget.toForm();
						}
					},{
						id:"back",
						type:"button",
						text:"返回",
						show : false,
						handler:function(){
							widget.toGrid();
						}
					}]
				}
			});
			
			widget.set("subnav",subnav);
		}
	};
});